package com.ewo.service.impl.workOrder;

import com.ewo.entity.workOrder.WorkOrderInfo;
import com.ewo.mapper.WorkOrderInfoMapper;
import com.ewo.service.workOrder.WorkOrderInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class WorkOrderInfoServiceImpl implements WorkOrderInfoService {
    @Resource
    WorkOrderInfoMapper workOrderInfoMapper;

    //查找所有工单池信息
    public List<WorkOrderInfo> findAllWorkOrderInfo(){
       return workOrderInfoMapper.findAllWorkOrderInfo();
    }

    //根据当前员工id查找相关状态不为1的工单
    public List<WorkOrderInfo> findWorkOrderInfoByEmpId(int empId){
        return workOrderInfoMapper.findWorkOrderInfoByEmpId(empId);
    }


    //查找工单池为未抢单的工单信息
    public List<WorkOrderInfo> findInitWorkOrderInfo(){
        return workOrderInfoMapper.findInitWorkOrderInfo();
    }

    //根据工单id修改当前工单状态,并将工单分配给此员工
    public int updateWorkOrderInfoById(int orderId,int work_status,int empId){
        return workOrderInfoMapper.updateWorkOrderInfoById(orderId, work_status,empId);
    }
    //取消工单,根据工单id修改当前工单状态为1
    public int updateWorkStatusByOrderId(int orderId,int work_status){
        return workOrderInfoMapper.updateWorkStatusByOrderId(orderId, work_status);
    }

    //根据工单id查找工单池信息
    public WorkOrderInfo findWorkOrderInfoByOrderId(int id){
        return workOrderInfoMapper.findWorkOrderInfoByOrderId(id);
    }

    //根据empId查找今日工单数
    public int findTodayOrder(int empId){
        return workOrderInfoMapper.findTodayOrder(empId);
    }
    //根据empId查找本月工单数
    public int findMonthOrder(int empId){
        return workOrderInfoMapper.findMonthOrder(empId);
    }
}
